<?php

namespace app\controllers;

use Yii;
use yii\web\Controller;
use yii\web\Request;
use yii\web\Response;
use proxy\HttpProxy;
use helper\SessionHelper;


class RespagenewController extends BaseController
{
    public function actionCall(){
        $response = Yii::$app->response;
        $request = Yii::$app->request;

        $cookies = Yii::$app->request->cookies;

      // //  echo '这是 cookies信息:'.$cookies->get('PHPSESSID') ; exit ; 
      //   //var_dump(  $cookies->get("PHPSESSID")); exit ; 
      //   echo Yii::$app->session->id ; exit ; 
        $thisPath = $request->getPathInfo();
        $path_array = explode("/", $thisPath);//0:ajax, 1:call, 2,3:后端服务url 
        $new_path = '' ;
        for ($i=2; $i < count($path_array); $i++) { 
            if($i>2){
                $new_path = $new_path.'/';
            }
            $new_path = $new_path.$path_array[$i];
            
        }
       
        if($path_array[2]=="venderappnew"&&$path_array[3]=="login.html"){
            return $this->myRenderFile('@app/resource/page/venderappnew/login.html', []);
        }

        $check = $this->session->check($this->auth);
        //echo $check['status'] ; exit ; 
        if ($check['status'] == 0) {  //正常登陆
            
            return $this->myRenderFile('@app/resource/page/'.$new_path, []);
        } else if ($check['status'] == 1) {
            //没有登陆
            return $this->myRenderFile('@app/resource/page/venderappnew/login_begin.html', []);
            
        } else if ($check['status'] == 2) {
            //没有权限
            return $this->myRenderFile('@app/resource/page/venderappnew/login_begin.html', []);
            
        } else {
            return $this->myRenderFile('@app/resource/page/venderappnew/login_begin.html', []);
            
        }    

    }


    
}
